<!DOCTYPE html>
<html>
<head>
	<script type="text/javascript" src="__PUBLIC__/easyui/jquery.min.js"></script>
	<script type="text/javascript" src="__PUBLIC__/easyui/jquery.easyui.min.js"></script>
	<script type="text/javascript" src="__PUBLIC__/easyui/locale/easyui-lang-zh_CN.js"></script>
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/easyui/themes/gray/easyui.css">
	<link rel="stylesheet" type="text/css" href="__PUBLIC__/easyui/themes/icon.css">
	<script type="text/javascript" src="__PUBLIC__/js/add-tab.js"></script>
	<script type="text/javascript" src="__PUBLIC__/js/common.js"></script>
	<style type="text/css">
		.contain{
			padding: 20px;
		}
		.contain img{
			width: expression(this.width > 600px ? 600px : true); max-width: 600px;
		}
		.info_title{
			text-align: center;
			font-size: 20px;

		}
		.info_content{
			text-indent: 2em;
		}
	</style>
</head>
<body>
	<div id="tb" style="padding:5px;height:auto">
		<div style="margin-bottom:5px">
			<a href="javascript:void(0);"  class="easyui-linkbutton cs-navi-tab-select" id="detail_page" iconCls="icon-search">查看详情</a>
		</div>
	</div>
	<table id="tt" title="公司公告" class="easyui-datagrid" style="width:auto;height:auto;" idField="employe_id" iconCls="icon-employe" pageSize="20" pageList="[20,40,80]" 
	data-options="rownumbers:true,singleSelect:true,url:'__URL__/adListData',toolbar:'#tb',iconCls:'icon-announce'" pagination="true" fitColumns="true" fit="true">
		<thead>
			<tr>
				<th data-options="field:'info_title',width:150,align:'center'">标题</th>
				<th data-options="field:'info_content',width:150,align:'center'" formatter="formatContent">内容</th>
				<th data-options="field:'info_employe_id',width:150,align:'center'">作者</th>
				<th data-options="field:'info_time',width:150,align:'center'" formatter="formatTime">发布时间</th>
			</tr>
		</thead>
	</table>

	<div id="dlg" class="easyui-dialog"  style="width:800px;height:450px;"  buttons="#dlg-buttons" closed='true' title="详情内容">
		<div class="contain">
		<p class="info_title"></p>
		<p class="info_content"></p>
		</div>
    </div>
<script type="text/javascript">

	function formatTime(val,row) {     
	 	return new Date(parseInt(val) * 1000).toLocaleString().replace(/年|月/g, "-").replace(/日/g, " ");
	}

	function formatContent(val,row){
		var val=removeHtmlTag(val);
		val=substrChinese(val,10)+'...';
		return val;
	}


	$(function(){
		
		$('#tt').datagrid({
			onDblClickRow: function(rowIndex,rowData){
				$('.info_title').html(rowData.info_title);
				$('.info_content').html(rowData.info_content);
				$('#dlg').dialog(
			        {
			            closed:false
			            		            
			        }
			    );
			}
		});

		var i=1;
		var j=1;
		$('#detail_page').click(function(){
			var row = $('#tt').datagrid('getSelected');
			if(row){
				$('.info_title').html(row.info_title);
				$('.info_content').html(row.info_content);
				$('#dlg').dialog(
			        {
			            closed:false
			            		            
			        }
			    );
		    }
			else {
            	$.messager.alert('提示', '请选择一条信息', 'info');
            }
		})

		

		

	});	
</script>
</body>
</html>